package com.leyou.item.mapper.lymapper;

import com.leyou.item.entity.Brand;
import com.leyou.item.mapper.LyBaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author linzx
 * @date 2020/3/24
 */
public interface BrandMapper extends LyBaseMapper<Brand> {

    @Insert("insert into tb_category_brand(category_id,brand_id) values(#{cid},#{bid})")
    int insertCategoryBrand(@Param("cid")Long cid ,@Param("bid")Long bid);



    @Delete("delete from tb_category_brand where brand_id = #{bid}")
    int deleteCategoryBrandByBrandId(@Param("bid") Long bid);

    @Select("select a.id, a.image, a.letter, a.`name`  FROM tb_brand a JOIN tb_category_brand b on b.brand_id = a.id WHERE b.category_id = #{cid};")
    List<Brand> findBrandByCid(@Param("cid") Long cid);

}
